package com.test.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.test.entity.Student;
import com.test.service.StudentService;
import com.test.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/students")
public class StudentController {
    @Resource
    StudentService studentService;
    @GetMapping("/pages")
    public ResponseResult pages(@RequestParam Integer currentPage,
                                @RequestParam Integer pageSize){
        Page<Student> page =studentService.pages(currentPage,pageSize);
        return ResponseResult.success(page);
    }
    @GetMapping("/deleteById")
    public ResponseResult delete(@RequestParam Integer id){
        studentService.delete(id);
        return ResponseResult.success();
    }
}
